<?php
namespace Amis\feedback;

use Amis\Basics\AmisBasics;

class Drawer extends AmisBasics
{
    public string $type       = 'button';
    public $actionType = 'drawer';

    public function title(string $title)
    {
        $this->title = $title;
        return $this;
    }

    public function body(array $body = [])
    {
        $this->body = $body;
        return $this;
    }

    public function size(string $size = '')
    {
        if (in_array($size, ['xs', 'sm', 'md', 'lg'])) {
            $this->size = $size;
        }
        return $this;
    }

    public function position(string $position = '')
    {
        if (in_array($position, ['left', 'right', 'top', 'bottom'])) {
            $this->position = $position;
        }
        return $this;
    }

    public function className($className)
    {
        $this->className = $className;
        return $this;
    }

    public function headerClassName($headerClassName = 'panel-heading')
    {
        $this->headerClassName = $headerClassName;
        return $this;
    }

    public function bodyClassName($bodyClassName = 'panel-body')
    {
        $this->bodyClassName = $$bodyClassName;
        return $this;
    }

    public function showCloseButton(bool $showCloseButton = true)
    {
        $this->showCloseButton = $showCloseButton;
        return $this;
    }

    public function footerClassName($footerClassName = 'panel-footer bg-light lter wrapper')
    {
        $this->footerClassName = $footerClassName;
        return $this;
    }

    public function closeOnEsc(bool $closeOnEsc = false)
    {
        $this->closeOnEsc = $closeOnEsc;
        return $this;
    }

    public function closeOnOutside(bool $closeOnOutside = false)
    {
        $this->closeOnOutside = $closeOnOutside;
        return $this;
    }

    public function overlay(bool $overlay = true)
    {
        $this->overlay = $overlay;
        return $this;
    }

    public function resizable(bool $resizable = true)
    {
        $this->resizable = $resizable;
        return $this;
    }

    public function width(string $width = '500px')
    {
        $this->width = $width;
        return $this;
    }

    public function height(string $height = '500px')
    {
        $this->height = $height;
        return $this;
    }

    public function actions(array $actions)
    {
        $this->actions = $actions;
        return $this;
    }

    public function data(array $data)
    {
        $this->data = $data;
        return $this;
    }
}